package com.yzg.sign.project.domain;




import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Proxy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;


@Entity
@Data
@Proxy(lazy = false)
@Table(name = "c_sys_user")
@EntityListeners(AuditingEntityListener.class)
public class SysUser implements Serializable
{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(columnDefinition = "VARCHAR(50) COMMENT '主键ID'")
    private Integer id;

    @ApiModelProperty("用户名")
    @Column(columnDefinition = "VARCHAR(50) COMMENT '用户名'")
    private String userName;

    @ApiModelProperty("密码")
    @JsonIgnore
    @Column(columnDefinition = "VARCHAR(50) COMMENT '密码'")
    private String  password;

    @Column(columnDefinition = "VARCHAR(50) COMMENT '盐值'")
    @JsonIgnore
    private String salt;

    @Column(columnDefinition = "tinyint(1) COMMENT '是否可用'")
    @ApiModelProperty(value = "是否可用")
    private Boolean available;


    @ApiModelProperty(value = "手机号")
    @Column(columnDefinition = "VARCHAR(30) COMMENT '手机号'")
    private String  phone;



    @ApiModelProperty("角色")
    @Column(columnDefinition = "VARCHAR(255) COMMENT '角色'")
    private String role;


    @Column(name = "`delete`",columnDefinition = "tinyint(1) default 0 COMMENT '是否已被删除'")
    @ApiModelProperty(value = "是否已被删除")
    private Boolean delete=false;




    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(columnDefinition = "DATETIME COMMENT '创建时间'")
    private Date created;

    @LastModifiedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(columnDefinition = "DATETIME COMMENT '修改时间'")
    private Date updated;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(columnDefinition = "DATETIME COMMENT '上次登录时间'")
    private  Date loginTimeBefore;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(columnDefinition = "DATETIME COMMENT '登录时间'")
    private  Date loginTimeNow;

    @Version
    @ApiModelProperty(value = "版本号")
    @Column(columnDefinition = "INTEGER(10) COMMENT '版本号'")
    private int versionId;

}
